<?php

namespace Proj\ResManBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Activity
 *
 * @ORM\Table(name="activity")
 * @ORM\Entity
 */
class Activity
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255, unique=false, nullable=false)
     */
    private $name;

    /**
     * @var string
     *
     * @ORM\Column(name="description", type="string", length=255, unique=false, nullable=true)
     */
    private $description;
    
     /**
     *
     * @var \DateTime
     * 
     * @ORM\Column(name="creation_date", type="datetime", nullable=false, unique=false) 
     */
    private $creationDate;
    
    /**
     *
     * @var string
     * 
     * @ORM\Column(name="type", type="string", length=50, nullable=false, unique=false)
     */
    private $type;
    
    /**
     *
     * @var integer
     * 
     * @ORM\Column(name="nhours", type="integer", nullable=true, unique=false)
     */
    private $hours;
    
    /**
     * @var Date
     * 
     * @ORM\Column(name="start_date", type="date", nullable=true, unique=false)
     */
    private $startDate;
    
    /**
     * @var Date
     * 
     * @ORM\Column(name="end_date", type="date", nullable=true, unique=false)
     */
    private $endDate;

    /**
     * @var \Doctrine\Common\Collections\ArrayCollection
     *
     * @ORM\OneToMany(targetEntity="Task", mappedBy="activity")
     */
    private $tasks;
   
    /**
     * 
     * @var Project
     * 
     * @ORM\ManyToOne(targetEntity="Project", inversedBy="activities", cascade={"remove"})
     * @ORM\JoinColumn(name="project_id", referencedColumnName="id")
     */
    private $project;
    
    /**
     * @var boolean
     *
     * @ORM\Column(name="approved", type="boolean")
     */
    private $approved;
    
    
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->resource = new \Doctrine\Common\Collections\ArrayCollection();
        $this->task = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Activity
     */
    public function setName($name)
    {
        $this->name = $name;
    
        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set description
     *
     * @param string $description
     * @return Activity
     */
    public function setDescription($description)
    {
        $this->description = $description;
    
        return $this;
    }

    /**
     * Get description
     *
     * @return string 
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set creationDate
     *
     * @param \DateTime $creationDate
     * @return Activity
     */
    public function setCreationDate($creationDate)
    {
        $this->creationDate = $creationDate;
    
        return $this;
    }

    /**
     * Get creationDate
     *
     * @return \DateTime 
     */
    public function getCreationDate()
    {
        return $this->creationDate;
    }

    /**
     * Set type
     *
     * @param string $type
     * @return Activity
     */
    public function setType($type)
    {
        $this->type = $type;
    
        return $this;
    }

    /**
     * Get type
     *
     * @return string 
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Set hours
     *
     * @param integer $hours
     * @return Activity
     */
    public function setHours($hours)
    {
        $this->hours = $hours;
    
        return $this;
    }

    /**
     * Get hours
     *
     * @return integer 
     */
    public function getHours()
    {
        return $this->hours;
    }

    /**
     * Set startDate
     *
     * @param \DateTime $startDate
     * @return Activity
     */
    public function setStartDate($startDate)
    {
        $this->startDate = $startDate;
    
        return $this;
    }

    /**
     * Get startDate
     *
     * @return \DateTime 
     */
    public function getStartDate()
    {
        return $this->startDate;
    }

    /**
     * Set endDate
     *
     * @param \DateTime $endDate
     * @return Activity
     */
    public function setEndDate($endDate)
    {
        $this->endDate = $endDate;
    
        return $this;
    }

    /**
     * Get endDate
     *
     * @return \DateTime 
     */
    public function getEndDate()
    {
        return $this->endDate;
    }

    /**
     * Add resource
     *
     * @param \Proj\ResManBundle\Entity\Resources $resource
     * @return Activity
     */
    public function addResource(\Proj\ResManBundle\Entity\Resources $resource)
    {
        $this->resource[] = $resource;
    
        return $this;
    }

    /**
     * Remove resource
     *
     * @param \Proj\ResManBundle\Entity\Resources $resource
     */
    public function removeResource(\Proj\ResManBundle\Entity\Resources $resource)
    {
        $this->resource->removeElement($resource);
    }

    /**
     * Get resource
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getResource()
    {
        return $this->resource;
    }

    /**
     * Add task
     *
     * @param \Proj\ResManBundle\Entity\Task $task
     * @return Activity
     */
    public function addTask(\Proj\ResManBundle\Entity\Task $task)
    {
        $this->task[] = $task;
    
        return $this;
    }

    /**
     * Remove task
     *
     * @param \Proj\ResManBundle\Entity\Task $task
     */
    public function removeTask(\Proj\ResManBundle\Entity\Task $task)
    {
        $this->task->removeElement($task);
    }

    /**
     * Get task
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getTask()
    {
        return $this->task;
    }

    /**
     * Set approved
     *
     * @param boolean $approved
     * @return Activity
     */
    public function setApproved($approved)
    {
        $this->approved = $approved;

        return $this;
    }

    /**
     * Get approved
     *
     * @return boolean 
     */
    public function getApproved()
    {
        return $this->approved;
    }

    /**
     * Get resources
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getResources()
    {
        return $this->resources;
    }

    /**
     * Get tasks
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getTasks()
    {
        return $this->tasks;
    }

    /**
     * Set project
     *
     * @param \Proj\ResManBundle\Entity\Project $project
     * @return Activity
     */
    public function setProject(\Proj\ResManBundle\Entity\Project $project = null)
    {
        $this->project = $project;

        return $this;
    }

    /**
     * Get project
     *
     * @return \Proj\ResManBundle\Entity\Project 
     */
    public function getProject()
    {
        return $this->project;
    }
}
